#!/usr/bin/env python3

import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
import sys

f = nc.Dataset(sys.argv[1], 'r')
e0 = f.variables['te'][0]

fig, ax = plt.subplots()

ax.plot((f.variables['te'] - e0) / e0)
ax.plot(np.zeros((f.dimensions['time'].size)), c='black')
ax.set_xlabel('Days')
ax.set_ylabel('Energy conservation relative error')
plt.show()
